package com.recipedb.recipedb.service.impl;

import com.recipedb.recipedb.entity.RecipeCategory;
import com.recipedb.recipedb.entity.RecipeCategoryId;
import com.recipedb.recipedb.repository.RecipeCategoryRepository;
import com.recipedb.recipedb.service.RecipeCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;

@Service
public class RecipeCategoryServiceImpl implements RecipeCategoryService {

    @Autowired
    private RecipeCategoryRepository repository;

    @Override
    public RecipeCategory save(RecipeCategory entity) {
        return repository.save(entity);
    }

    @Override
    public void deleteById(RecipeCategoryId id) {
        repository.deleteById(id);
    }

    @Override
    public Optional<RecipeCategory> findById(RecipeCategoryId id) {
        return repository.findById(id);
    }

    @Override
    public List<RecipeCategory> findAll() {
        return repository.findAll();
    }
}
